//
//  ViewController.swift
//  ScrollViewReView
//
//  Created by Pro on 2018/4/10.
//  Copyright © 2018年 Pro. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        
        super.viewDidLoad()
        view.backgroundColor = UIColor.lightGray
        
        test()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    func test(){
       
        var frame = self.view.bounds
        frame.size.height = 220
        frame.origin.y = 100
        
        let view1 = TTPageScrollView(frame: frame)
        view.addSubview(view1)
        
        view1.config(viewSpace: 10.0, edgesForExtended: 50.0, pageNumber: 3) { (containerView, index, frame) in
            let view2 = UIView(frame:frame)
            view2.backgroundColor = self.randonColor()
            view.layer.cornerRadius = 5
            containerView.addSubview(view2)
        }
        
        
    }
    func randonColor() -> UIColor {
        let randomR:CGFloat = CGFloat(drand48())
        let randomG:CGFloat = CGFloat(drand48())
        let randomB:CGFloat = CGFloat(drand48())
        
        return UIColor(red: randomR, green: randomG, blue: randomB, alpha: 1.0)
        
    }

}

